import java.util.Scanner;

public class P106lianxi2 {
	public static void main(String[] args) {
		System.out.println("MyShopping管理系统》》》》购物结算\n");
		System.out
				.println("**********************************************************************************************************");
		System.out.println("请选择购买的编号：");
		System.out
				.println("1.T恤                   2.网球鞋                  3.网球拍");
		System.out
				.println("**********************************************************************************************************");
		int num, shuliang = 0;
		double price = 1, sum = 0, shifu = 0, zhekou = 0.8, total = 0, zhaoling = 0;
		String name = "", jixu = "y";
		Scanner scan = new Scanner(System.in);
		while (jixu.equals("y")) {
			System.out.println("请选择购买的编号：");
			num = scan.nextInt();
			System.out.println("请选择购买的数量：");
			shuliang = scan.nextInt();
			switch (num) {
			case 1:
				name = "T恤";
				price = 245.0;
				break;
			case 2:
				name = "网球鞋";
				price = 570;
				break;
			case 3:
				name = "网球拍";
				price = 320;
				break;
			default:
				price = 0;
				System.out.println("输入错误！");
				break;
			}
			sum = price * shuliang;
			System.out.println(name + "\t" + price + "\t数量" + shuliang
					+ "\t合计：" + sum);
			System.out.println("是否继续（y/n）:");
			jixu = scan.next();
			total = total + sum;
		}
		total = total * 0.8;
		System.out.println("折扣为：" + zhekou);
		System.out.println("应付金额：" + total);
		do {
			System.out.println("请输入你要给多少钱:");
			shifu = scan.nextDouble();
			System.out.println("实付金额:" + shifu);
			zhaoling = shifu - total;
		} while (zhaoling < 0);
		System.out.println("找零：" + zhaoling);
	}
}
